package lk.icta.core.entity;

import lk.icta.common.entity.Document;

import javax.persistence.*;
import java.util.List;

/**
 * @author Tharanga Punchihewa
 */
@Entity
@Table(schema = "ELAND_RAIL")
@NamedQueries({
        @NamedQuery(name = "getGOInterestInformationListByState", query = "SELECT g FROM GOInterestInformation g WHERE g.status=:status"),
        @NamedQuery(name = "getGOInterestInformationListToBeEdited", query = "SELECT g FROM GOInterestInformation g WHERE g.status=0 OR g.status=2"),
        @NamedQuery(name = "getGOInterestInformationList", query = "SELECT g FROM GOInterestInformation g"),
        @NamedQuery(name = "getGOInterestInformationListByOrganizationId", query = "SELECT g FROM GOInterestInformation g WHERE g.organizationId=:organizationId  ")
})
public class GOInterestInformation {


    public enum State {
        DATA_ENTRY,  // 0 - data entry state.
        REJECTED,   // 1 -reject
        APPROVED   // 2 - approved

    }

    /**
     * This is an auto generated unique row identifier
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(nullable = false)
    private String referenceNumber;

    @Column(nullable = false)
    private String natureOfInterest;

    @Column(nullable = false)
    private String permissionMethod;

    @Column(nullable = false)
    private State status;

    @Column(nullable = false)
    private boolean isActive;

    @Column(nullable = true)
    private String conditionOfInterest;

    @Column(nullable = true)
    private String validPeriod;

    @Column(nullable = true)
    private String alienated;

    @Column(nullable = true)
    private String comment;

    @Column(nullable = true)
    private Double kmlLandArea;

    @Column(columnDefinition = "text")
    private String kmlString;

    @Column(nullable = true)
    private String kmlMiddlePoint;

    @Column(nullable = false)
    private int organizationId;


    @Transient
    private List<Document> documentList;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getReferenceNumber() {
        return referenceNumber;
    }

    public void setReferenceNumber(String referenceNumber) {
        this.referenceNumber = referenceNumber;
    }

    public String getNatureOfInterest() {
        return natureOfInterest;
    }

    public void setNatureOfInterest(String natureOfInterest) {
        this.natureOfInterest = natureOfInterest;
    }

    public String getPermissionMethod() {
        return permissionMethod;
    }

    public void setPermissionMethod(String permissionMethod) {
        this.permissionMethod = permissionMethod;
    }

    public State getStatus() {
        return status;
    }

    public void setStatus(State status) {
        this.status = status;
    }

    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean active) {
        isActive = active;
    }

    public List<Document> getDocumentList() {
        return documentList;
    }

    public void setDocumentList(List<Document> documentList) {
        this.documentList = documentList;
    }

    public String getConditionOfInterest() {
        return conditionOfInterest;
    }

    public void setConditionOfInterest(String conditionOfInterest) {
        this.conditionOfInterest = conditionOfInterest;
    }

    public String getValidPeriod() {
        return validPeriod;
    }

    public void setValidPeriod(String validPeriod) {
        this.validPeriod = validPeriod;
    }

    public String getAlienated() {
        return alienated;
    }

    public void setAlienated(String alienated) {
        this.alienated = alienated;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Double getKmlLandArea() {
        return kmlLandArea;
    }

    public void setKmlLandArea(Double kmlLandArea) {
        this.kmlLandArea = kmlLandArea;
    }

    public String getKmlString() {
        return kmlString;
    }

    public void setKmlString(String kmlString) {
        this.kmlString = kmlString;
    }

    public String getKmlMiddlePoint() {
        return kmlMiddlePoint;
    }

    public void setKmlMiddlePoint(String kmlMiddlePoint) {
        this.kmlMiddlePoint = kmlMiddlePoint;
    }

    public int getOrganizationId() {
        return organizationId;
    }

    public void setOrganizationId(int organizationId) {
        this.organizationId = organizationId;
    }
}
